//
//  LJHotQACell.m
//  BaseProject
//
//  Created by 王洋 on 2020/12/11.
//  Copyright © 2020 王洋. All rights reserved.
//

#import "LJHotQACell.h"

@implementation LJHotQACell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)layoutSubviews {
    [super layoutSubviews];
    
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        [self pp_clipCorners:UIRectCornerAllCorners radius:6];

        [self.userIcon pp_clipCorners:UIRectCornerAllCorners radius:self.userIcon.frame.size.height/2];

    });
    
}

- (void)fillWith:(CommunitySellerModel*)model {
    
    
    self.mainTitleLab.text = model.mqContent;
    
    if (model.uaContent.length > 0) {
        self.contentLab.text = model.uaContent;
    }
    
    [self.userIcon sd_setImageWithURL:[NSURL URLWithString:model.sellerHeadUrl] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    self.replyerLab.text = [NSString stringWithFormat:@"%@ 回复：",model.sellerName];
    
    self.replyCountLab.text = [NSString stringWithFormat:@"共%@回答",model.uaCount];
    
    NSInteger index = model.index%5;
    switch (index) {
        case 0:{
            self.backgroundColor = UIColorHex(0xFFEDE1);
        } break;
        case 1:{
            self.backgroundColor = UIColorHex(0xE1F0FF);
        } break;
        case 2:{
            self.backgroundColor = UIColorHex(0xE9E5FF);
        } break;
        case 3:{
            self.backgroundColor = UIColorHex(0xFFE8E5);
        } break;
        case 4:{
            self.backgroundColor = UIColorHex(0xE3FFFD);
        } break;
        default:
            break;
    }
    
}

@end
